/* 
 * File:   User.h
 * Author: user
 *
 * Created on July 23, 2014, 1:29 AM
 */

#ifndef User_H
#define	User_H

#include <iostream>
#include <sstream>
#include <cstdlib>
#include <iomanip>
#include <sqlite3.h>
#include "LoginAccount.h"
#include "LoginController.h"

using namespace std;

enum userType
{
    ADMIN = 0,
    LECTURER,
    CANDIDATE,
    INVALID = 99
};
enum menuItemType
{
    LOG_OUT=0,
    ADD_ACCT,
    UPDATE_ACCT,
    DEL_ACCT,
    QUIT_PROGRAM
};

class User 
{
public:
    User();
    User(string userID, int userType);
    //User(int userType);
    User(const User& orig);
    virtual ~User();
    
    virtual void printMenu() = 0;
    virtual bool menuAction(int iSelection,bool& isExitProgram, int& loginStatus) =0;
    //menu item action
    virtual void menuItemAction(menuItemType action,bool& isExitProgram,int& loginStatus);
    virtual bool executeSql(const char* sql);
    virtual bool validateIntInput(string input, int& output);
    
    string getUserID();
    string getLoginID();
    int login();
    bool addAccount(string userID,string loginID, string loginPass,int userType, string createBy);
    bool deleteAccount(string index);
    bool updateAccount(string index, string newUserID);
    void displayAllUserAccount(string createBy);
    
private:
    
    LoginController _loginController;
    string getUserPassword();
    static int querryCallBack (void *NotUsed, int argc, char **argv, char **azColName);
    
protected:
    LoginAccount _loginAccount;
    string _userID;
    int _userType; 
    
};

#endif	/* User_H */

